# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=zanshin
pkgver=24.02.2
pkgrel=1
# armhf blocked by qt6-qtdeclarative
# armv7, ppc64le and s390x blocked by qt6-qtwebengine -> akonadi-calendar
arch="all !armhf !armv7 !ppc64le !s390x !riscv64"
url="https://zanshin.kde.org/"
pkgdesc="A Getting Things Done application which aims at getting your mind like water"
license="(GPL-2.0-only OR GPL-3.0-only) AND LGPL-2.0-or-later"
makedepends="
	akonadi-calendar-dev
	boost-dev
	extra-cmake-modules
	ki18n-dev
	kontactinterface-dev
	krunner-dev
	kwindowsystem-dev
	qt6-qtbase-dev
	samurai
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-lang"
_repo_url="https://invent.kde.org/pim/zanshin.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/zanshin-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# tests-units-akonadi-akonadistoragetest, tests-units-akonadi-akonadicachingstorageintegrationtest,
	# tests-units-presentation-alltaskspagemodeltest, tests-units-widgets-editorviewtest,
	# tests-units-widgets-pageviewtest, tests-units-migrator-zanshin021migrationtest,
	# tests-units-migrator-zanshincontextitemsmigrationtest are broken
	local skipped_tests="("
	local tests="
		tests-units-akonadi-akonadistoragetest
		tests-units-akonadi-akonadicachingstorageintegrationtest
		tests-units-presentation-alltaskspagemodeltest
		tests-units-widgets-editorviewtest
		tests-units-widgets-pageviewtest
		tests-units-migrator-zanshin021migrationtest
		tests-units-migrator-zanshincontextitemsmigrationtest"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
1d5026288c6f280580f2a8bbfaf8cf69ad5ec218927f393d951bda8a13690c1ca3cfcd11edc2c18260e6602e5710476464f71f83ad5b0475674204a95d588a62  zanshin-24.02.2.tar.xz
"
